package be.bonamis.timesheet.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;

import org.hibernate.annotations.Type;
import org.joda.time.LocalDateTime;

@Entity
@Table(name = "prestation")
public class Prestation extends PersistentObject {

	private static final long serialVersionUID = 1L;

	@ManyToOne
	@PrimaryKeyJoinColumn(name = "project_id", referencedColumnName = "ID")
	private Project project;

	@ManyToOne
	@PrimaryKeyJoinColumn(name = "person_id", referencedColumnName = "ID")
	private Person person;

	@ManyToOne
	@PrimaryKeyJoinColumn(name = "type_id", referencedColumnName = "ID")
	private PrestationType type;

	@Column(name = "prestation_day", nullable = false)
	@Type(type = "org.jadira.usertype.dateandtime.joda.PersistentLocalDateTime")
	private LocalDateTime day;

	@Column(name = "prestation_time", nullable = false)
	private int time;

	public Project getProject() {
		return project;
	}

	public void setProject(Project project) {
		this.project = project;
	}

	public Person getPerson() {
		return person;
	}

	public void setPerson(Person person) {
		this.person = person;
	}

	public PrestationType getType() {
		return type;
	}

	public void setType(PrestationType type) {
		this.type = type;
	}

	public LocalDateTime getDay() {
		return day;
	}

	public void setDay(LocalDateTime day) {
		this.day = day;
	}

	public int getTime() {
		return time;
	}

	public void setTime(int time) {
		this.time = time;
	}

}
